package com.example.trb.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.example.trb.entity.group.Insert;
import com.example.trb.entity.group.Update;
import com.example.trb.validation.DateTime;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
public class Paper {
    @TableId(type = IdType.AUTO)
    private Integer id;

    @NotNull(groups = Insert.class)
    private Integer reviewFormId;

    @DateTime(groups = {Insert.class, Update.class})
    @NotBlank(groups = {Insert.class, Update.class})
    private String publishTime;

    @NotBlank(groups = {Insert.class, Update.class})
    @Length(max = 8, groups = {Insert.class, Update.class})
    private String category;

    @NotBlank(groups = {Insert.class, Update.class})
    @Length(min = 1, max = 8, groups = {Insert.class, Update.class})
    private String role;

    @NotNull(groups = {Insert.class, Update.class})
    private boolean isRepresentative;

    @NotBlank(groups = {Insert.class, Update.class})
    @Length(min = 16, max = 16, groups = {Insert.class, Update.class})
    private String publicationNumber;

    @NotBlank(groups = {Insert.class, Update.class})
    private String name;

    @Pattern(regexp = "待审核|未通过|已通过")
    private String status;
}
